﻿top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
	
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}

function showHideRow(rowID, OpenerID, ClassOn, ClassOff){
	var obj=(document.all) ? document.all[rowID] : document.getElementById(rowID);
	var objOpener=(document.all) ? document.all[OpenerID] : document.getElementById(OpenerID);
	
    obj.style.display=(obj.style.display=="block"?"none":"block");
	objOpener.className=(objOpener.className==ClassOff?ClassOn:ClassOff);
}

function verifyRowClassChange(parentID, childID, targetClass) {
	var objChild =(document.all) ? document.all[childID] : document.getElementById(childID);
	var objParent =(document.all) ? document.all[parentID] : document.getElementById(parentID);
	
	if (objChild.style.display == "none") {
		objParent.className = targetClass;
	}
}
function showHideObject(objectID) {
	var obj=(document.all) ? document.all[objectID] : document.getElementById(objectID);
    obj.style.display=(obj.style.display=="block"?"none":"block");
}
function getElementsByClass(searchClass) {
	var classElements = new Array();
	var node = document;
	var tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\\\s)'+searchClass+'(\\\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			classElements[j].style.display=(classElements[j].style.display=="block"?"none":"block");
			j++;
		}
	}
	
}

// Function to fix URL paths
function FixURL(strURL, strPathToRoot)
{
	// If there's a need for optimization
	if (strURL.indexOf("/") != 0 && strURL.indexOf("http://") != 0)
	{	
		// Fix URLs beginning with www (misuse of full path URL)
		if (strURL.indexOf("www.") == 0)
		{
			strURL = "http://" + strURL;
		} 
		// Fix URLs attempting to make use of relative URLs
		else if (strURL.value != "")
		{
			strURL = strPathToRoot + strURL;
		}
	}
	
	// Return optimized URL
	return strURL;
}
